//
//  XMInfoEditViewController.m
//  XMJJ_zml
//
//  Created by apple on 2025/5/14.
//

#import "XMInfoEditViewController.h"
#import "XMInfoEditView.h"

@interface XMInfoEditViewController ()

@property (nonatomic, strong) XMInfoEditView *infoEditView;

@end

@implementation XMInfoEditViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self creatUI];
}

- (void)creatUI {
    [self.view addSubview:self.infoEditView];
    [_infoEditView setContentWithUserInfoModel:_userInfoModel index:_editIndex];
    
    XMWeakSelf;
    _infoEditView.saveBlock = ^{
        weakSelf.infoSaveBlock ? weakSelf.infoSaveBlock() : nil;
        [weakSelf.navigationController popViewControllerAnimated:YES];
    };
//    XMChangeNameView *changeNameView = [[XMChangeNameView alloc] initWithFrame:self.view.bounds];
//    [changeNameView setContentWithName:self.userInfoModel.nickname];
//    [self.view addSubview:changeNameView];
//    XMWeakSelf;
//    changeNameView.nameSaveBlock = ^(NSString * _Nonnull nameStr) {
//        weakSelf.nameSaveBlock ? weakSelf.nameSaveBlock(nameStr) : nil;
//        [weakSelf.navigationController popViewControllerAnimated:YES];
//    };
}

- (XMInfoEditView *)infoEditView {
    if (!_infoEditView) {
        _infoEditView = [[XMInfoEditView alloc] initWithFrame:self.view.bounds];
    }
    return _infoEditView;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
